import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import Qs from 'qs'	//把json格式的直接转成data所需的格式

/*使用axios插件*/
Vue.prototype.$axios = axios;

// 全局注册组件
import MJUI from './components/index'
Vue.use(MJUI)

Vue.config.productionTip = false
Vue.prototype.qs = Qs;

new Vue({
  render: h => h(App),
  router,
  axios,
}).$mount('#app')

router.beforeEach((to, from, next) => {
	if (to.matched.length ===0) {  //如果未匹配到路由
		next('/empty')
		// from.path? next({ path:from.path}) : next('/');   //如果上级也未匹配到路由则跳转主页面，如果上级能匹配到则转上级路由
	} else {
		next();    //如果匹配到正确跳转
	}
});

console.log(` %c
 _      _       _   _   _   _____
| \\    / |     | | | | | | |_   _|
|  \\  /  |     | | | | | |   | |
|   \\/   |  _  | | | | | |   | |
| |\\  /| | | |_| | | |_| |  _| |_
|_| \\/ |_| |_____| |_____| |_____|

             一个基于Vue.js的高质量UI组件库
`, 'color: #45b984');
